'''过滤器,过滤很多差不多的CG,方法是设定文件名长,前面一样的算同类,只要一个文件'''

import os
import shutil

FLENGTH=len('EA01A101XXX_XXX0') # 文件名长
FNLIST=[]
DIR=r'F:\Download\Triangle\ev_jpg'
TARGETDIR=r'F:\Download\Triangle\ev_jpg_new'

for fn in os.listdir(DIR):
    shortFn=fn[0:FLENGTH]
    if not shortFn in FNLIST:
        FNLIST.append(shortFn)
        shutil.copyfile(DIR+'\\'+fn,TARGETDIR+'\\'+fn)

print('Copy '+str(len(FNLIST))+' files!')
